Skip to content

refactor: migrate WASignalGroup to TypeScript and remove deprecated files #1320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jlucaso1
Copy link
Contributor

Moving WASignalGroup to src and translated to typescript.

Removed group.proto and GroupProtocol because this can be reused in the main file of WAProto.

@whiskeysockets-bot
Copy link
Contributor

Thanks for your contribution.

The next step is to wait for review and approval to merge it to main repository

The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.

To test this PR you can run the following command below:

# NPM
npm install @whiskeysockets/baileys@jlucaso1/Baileys#refactor-wasignalgroup-to-typescript
# YARN v2
yarn add @whiskeysockets/baileys@jlucaso1/Baileys#refactor-wasignalgroup-to-typescript

@@ -0,0 +1,96 @@
import { proto } from '../../WAProto';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i mean with reusing proto types

@AstroXTeam
Copy link

Very much needed

@AstroXTeam
Copy link

But does it work?

@jlucaso1
Copy link
Contributor Author

jlucaso1 commented Mar 21, 2025

But does it work?

Preliminarily yes.
What i have tested:
Login -> Sending message to myself (with a patch in another PR, because the master branch has a bug) -> Sending and receiving message to a group. (using example.ts)
By the way, more tests are welcome

@AstroXTeam
Copy link

Any kind of performance improvements?

@jlucaso1
Copy link
Contributor Author

Any kind of performance improvements?

The performance gains here is minimal. (dev experience is the bigger gain)
But the file size bundle of the library is lighter, because i removed unused .proto file and type definitions in the project. So this can be good to startup time. (the logic of the WAGroup is the same, i only ported to typescript)

@AstroXTeam
Copy link

I see no need of removing the proto because it's not packed in the npm release, a those files are used for development and are very important

@jlucaso1
Copy link
Contributor Author

Yeah. Check the bundled files on npm: https://www.npmjs.com/package/baileys?activeTab=code
Basically i removed the WASignalGroup/GroupProtocol.js because is an js compiled .proto. We already cover this same functions in WAProto/index.js so is duplicated code.

@AstroXTeam
Copy link

ohh I see, very clever there, I thought it was 2 different protos

Copy link
Member

@purpshell purpshell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good for now, great work!

@purpshell purpshell added this to the 6.7.17 milestone Mar 29, 2025
Copy link
Member

@purpshell purpshell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix types and merge conflict

jlucaso1 added 2 commits April 9, 2025 14:01
…s to export and add deserialize method. Fix types
@jlucaso1 jlucaso1 requested a review from purpshell April 9, 2025 17:21
@AliAryanTech
Copy link
Contributor

failed, App\node_modules\libsignal\src\crypto.js:11
throw TypeError(Expected Buffer instead of: ${value.constructor.name});
^

TypeError: Expected Buffer instead of: Object
at assertBuffer (C:\App\node_modules\libsignal\src\crypto.js:11:15)

@jlucaso1
Copy link
Contributor Author

failed, App\node_modules\libsignal\src\crypto.js:11 throw TypeError(Expected Buffer instead of: ${value.constructor.name}); ^

TypeError: Expected Buffer instead of: Object at assertBuffer (C:\App\node_modules\libsignal\src\crypto.js:11:15)

can you provide an reproduction?

@jlucaso1 jlucaso1 marked this pull request as draft April 26, 2025 05:07
@jlucaso1
Copy link
Contributor Author

Moved to draft to investigate the problem that @AliAryanTech has reported

@canove canove added the enhancement New feature or request label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants